package route

import (
	"zhongxc.cc/mall-product-api/internal/handler"
	"zhongxc.cc/mall-product-api/internal/svc"
)

type RoutesHandler struct {
	routes *Routes
	svcCtx *svc.ServiceContext
}

// NewRoutesHandler
//
//	@Description: 返回路由处理器对象
//	@param routes
//	@param svcCtx
//	@return *RoutesHandler
func NewRoutesHandler(routes *Routes, svcCtx *svc.ServiceContext) *RoutesHandler {
	return &RoutesHandler{
		routes: routes,
		svcCtx: svcCtx,
	}
}

func (r *RoutesHandler) InitRouters() {
	r.ProductHandler(r.routes, r.svcCtx)
}

// ProductHandler 产品API接口相关的路由
func (r *RoutesHandler) ProductHandler(routes *Routes, serverCtx *svc.ServiceContext) {
	product := handler.NewProductHandler(serverCtx)

	productRouter := routes.Group()
	productRouter.Get("/product/info", product.ProductInfo)
}
